<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="电话" prop="mobile">
        <el-input
          v-model="queryParams.mobile"
          placeholder="请输入电话"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="账号" prop="account">
        <el-input
          v-model="queryParams.account"
          placeholder="请输入账号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="密码" prop="password">
        <el-input
          v-model="queryParams.password"
          placeholder="请输入密码"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="昵称" prop="userName">
        <el-input
          v-model="queryParams.userName"
          placeholder="请输入昵称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="真实姓名" prop="realName">
        <el-input
          v-model="queryParams.realName"
          placeholder="请输入真实姓名"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="微信号" prop="chatNumber">
        <el-input
          v-model="queryParams.chatNumber"
          placeholder="请输入微信号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="身份证" prop="idCard">
        <el-input
          v-model="queryParams.idCard"
          placeholder="请输入身份证"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="头像" prop="avatar">
        <el-input
          v-model="queryParams.avatar"
          placeholder="请输入头像"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="朋友圈背景图" prop="pyqBgImg">
        <el-input
          v-model="queryParams.pyqBgImg"
          placeholder="请输入朋友圈背景图"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="聊天背景图" prop="chatBgImg">
        <el-input
          v-model="queryParams.chatBgImg"
          placeholder="请输入聊天背景图"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="个性签名" prop="signature">
        <el-input
          v-model="queryParams.signature"
          placeholder="请输入个性签名"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="邮件" prop="email">
        <el-input
          v-model="queryParams.email"
          placeholder="请输入邮件"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="最后一次登录时间" prop="lastLoginTime">
        <el-date-picker clearable
          v-model="queryParams.lastLoginTime"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择最后一次登录时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="登录的设备ID,可用于推送的cid" prop="userDeviceId">
        <el-input
          v-model="queryParams.userDeviceId"
          placeholder="请输入登录的设备ID,可用于推送的cid"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="1系统管理员 0普通用户" prop="level">
        <el-input
          v-model="queryParams.level"
          placeholder="请输入1系统管理员 0普通用户"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="是否允许通过 id 搜索到我 1 是 2 否" prop="addMeId">
        <el-input
          v-model="queryParams.addMeId"
          placeholder="请输入是否允许通过 id 搜索到我 1 是 2 否"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="是否允许加我为好友 1 是 2 否" prop="addMe">
        <el-input
          v-model="queryParams.addMe"
          placeholder="请输入是否允许加我为好友 1 是 2 否"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="账户余额" prop="accountBalance">
        <el-input
          v-model="queryParams.accountBalance"
          placeholder="请输入账户余额"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="冻结余额" prop="accountFrozen">
        <el-input
          v-model="queryParams.accountFrozen"
          placeholder="请输入冻结余额"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="交易密码" prop="tradePwd">
        <el-input
          v-model="queryParams.tradePwd"
          placeholder="请输入交易密码"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="提现冻结金额" prop="tixianFrozen">
        <el-input
          v-model="queryParams.tixianFrozen"
          placeholder="请输入提现冻结金额"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="支付宝账户" prop="alipayAccount">
        <el-input
          v-model="queryParams.alipayAccount"
          placeholder="请输入支付宝账户"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="支付宝名字" prop="alipayName">
        <el-input
          v-model="queryParams.alipayName"
          placeholder="请输入支付宝名字"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="首字母" prop="pinyinChar">
        <el-input
          v-model="queryParams.pinyinChar"
          placeholder="请输入首字母"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="密保问题" prop="mibaoWenti">
        <el-input
          v-model="queryParams.mibaoWenti"
          placeholder="请输入密保问题"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="密保答案" prop="mibaoDaan">
        <el-input
          v-model="queryParams.mibaoDaan"
          placeholder="请输入密保答案"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="身份证正面" prop="idCardZheng">
        <el-input
          v-model="queryParams.idCardZheng"
          placeholder="请输入身份证正面"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="身份证反面" prop="idCardFan">
        <el-input
          v-model="queryParams.idCardFan"
          placeholder="请输入身份证反面"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="积分" prop="integral">
        <el-input
          v-model="queryParams.integral"
          placeholder="请输入积分"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="邀请码" prop="invitationCode">
        <el-input
          v-model="queryParams.invitationCode"
          placeholder="请输入邀请码"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="被邀请码" prop="otherInvitationCode">
        <el-input
          v-model="queryParams.otherInvitationCode"
          placeholder="请输入被邀请码"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="是否已推送审核通知 1是 2否" prop="notice">
        <el-input
          v-model="queryParams.notice"
          placeholder="请输入是否已推送审核通知 1是 2否"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="${comment}" prop="deviceStr">
        <el-input
          v-model="queryParams.deviceStr"
          placeholder="请输入${comment}"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="实名视频信息" prop="idCardVideo">
        <el-input
          v-model="queryParams.idCardVideo"
          placeholder="请输入实名视频信息"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="邀请码是否启用 1启用 2禁用" prop="invitationCodeFlag">
        <el-input
          v-model="queryParams.invitationCodeFlag"
          placeholder="请输入邀请码是否启用 1启用 2禁用"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="用户类型：内部  真实" prop="userFlag">
        <el-input
          v-model="queryParams.userFlag"
          placeholder="请输入用户类型：内部  真实"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="最后一次登录ip" prop="ip">
        <el-input
          v-model="queryParams.ip"
          placeholder="请输入最后一次登录ip"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['business:imUser:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['business:imUser:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['business:imUser:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['business:imUser:export']"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="imUserList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="自增主键" align="center" prop="id" />
      <el-table-column label="电话" align="center" prop="mobile" />
      <el-table-column label="账号" align="center" prop="account" />
      <el-table-column label="密码" align="center" prop="password" />
      <el-table-column label="昵称" align="center" prop="userName" />
      <el-table-column label="真实姓名" align="center" prop="realName" />
      <el-table-column label="微信号" align="center" prop="chatNumber" />
      <el-table-column label="身份证" align="center" prop="idCard" />
      <el-table-column label="头像" align="center" prop="avatar" />
      <el-table-column label="朋友圈背景图" align="center" prop="pyqBgImg" />
      <el-table-column label="聊天背景图" align="center" prop="chatBgImg" />
      <el-table-column label="个性签名" align="center" prop="signature" />
      <el-table-column label="性别   0男  1女" align="center" prop="sex" />
      <el-table-column label="地址" align="center" prop="address" />
      <el-table-column label="邮件" align="center" prop="email" />
      <el-table-column label="最后一次登录时间" align="center" prop="lastLoginTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.lastLoginTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="状态  0可用  1禁用" align="center" prop="activeStatus" />
      <el-table-column label="备注" align="center" prop="remark" />
      <el-table-column label="登录的设备ID,可用于推送的cid" align="center" prop="userDeviceId" />
      <el-table-column label="1系统管理员 0普通用户" align="center" prop="level" />
      <el-table-column label="是否允许通过 id 搜索到我 1 是 2 否" align="center" prop="addMeId" />
      <el-table-column label="是否允许加我为好友 1 是 2 否" align="center" prop="addMe" />
      <el-table-column label="账户余额" align="center" prop="accountBalance" />
      <el-table-column label="冻结余额" align="center" prop="accountFrozen" />
      <el-table-column label="交易密码" align="center" prop="tradePwd" />
      <el-table-column label="提现冻结金额" align="center" prop="tixianFrozen" />
      <el-table-column label="支付宝账户" align="center" prop="alipayAccount" />
      <el-table-column label="支付宝名字" align="center" prop="alipayName" />
      <el-table-column label="首字母" align="center" prop="pinyinChar" />
      <el-table-column label="密保问题" align="center" prop="mibaoWenti" />
      <el-table-column label="密保答案" align="center" prop="mibaoDaan" />
      <el-table-column label="身份证正面" align="center" prop="idCardZheng" />
      <el-table-column label="身份证反面" align="center" prop="idCardFan" />
      <el-table-column label="实名审核 1=已审核 2=已拒绝 3=待审核" align="center" prop="examineStatus" />
      <el-table-column label="积分" align="center" prop="integral" />
      <el-table-column label="邀请码" align="center" prop="invitationCode" />
      <el-table-column label="被邀请码" align="center" prop="otherInvitationCode" />
      <el-table-column label="是否已推送审核通知 1是 2否" align="center" prop="notice" />
      <el-table-column label="${comment}" align="center" prop="deviceStr" />
      <el-table-column label="实名视频信息" align="center" prop="idCardVideo" />
      <el-table-column label="邀请码是否启用 1启用 2禁用" align="center" prop="invitationCodeFlag" />
      <el-table-column label="用户类型：内部  真实" align="center" prop="userFlag" />
      <el-table-column label="最后一次登录ip" align="center" prop="ip" />
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['business:imUser:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['business:imUser:remove']"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>
    
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改即时通讯用户对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="电话" prop="mobile">
          <el-input v-model="form.mobile" placeholder="请输入电话" />
        </el-form-item>
        <el-form-item label="账号" prop="account">
          <el-input v-model="form.account" placeholder="请输入账号" />
        </el-form-item>
        <el-form-item label="密码" prop="password">
          <el-input v-model="form.password" placeholder="请输入密码" />
        </el-form-item>
        <el-form-item label="昵称" prop="userName">
          <el-input v-model="form.userName" placeholder="请输入昵称" />
        </el-form-item>
        <el-form-item label="真实姓名" prop="realName">
          <el-input v-model="form.realName" placeholder="请输入真实姓名" />
        </el-form-item>
        <el-form-item label="微信号" prop="chatNumber">
          <el-input v-model="form.chatNumber" placeholder="请输入微信号" />
        </el-form-item>
        <el-form-item label="身份证" prop="idCard">
          <el-input v-model="form.idCard" placeholder="请输入身份证" />
        </el-form-item>
        <el-form-item label="头像" prop="avatar">
          <el-input v-model="form.avatar" placeholder="请输入头像" />
        </el-form-item>
        <el-form-item label="朋友圈背景图" prop="pyqBgImg">
          <el-input v-model="form.pyqBgImg" placeholder="请输入朋友圈背景图" />
        </el-form-item>
        <el-form-item label="聊天背景图" prop="chatBgImg">
          <el-input v-model="form.chatBgImg" placeholder="请输入聊天背景图" />
        </el-form-item>
        <el-form-item label="个性签名" prop="signature">
          <el-input v-model="form.signature" placeholder="请输入个性签名" />
        </el-form-item>
        <el-form-item label="地址" prop="address">
          <el-input v-model="form.address" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="邮件" prop="email">
          <el-input v-model="form.email" placeholder="请输入邮件" />
        </el-form-item>
        <el-form-item label="最后一次登录时间" prop="lastLoginTime">
          <el-date-picker clearable
            v-model="form.lastLoginTime"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择最后一次登录时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="删除标志  1删除  0未删除" prop="delFlag">
          <el-input v-model="form.delFlag" placeholder="请输入删除标志  1删除  0未删除" />
        </el-form-item>
        <el-form-item label="备注" prop="remark">
          <el-input v-model="form.remark" placeholder="请输入备注" />
        </el-form-item>
        <el-form-item label="登录的设备ID,可用于推送的cid" prop="userDeviceId">
          <el-input v-model="form.userDeviceId" placeholder="请输入登录的设备ID,可用于推送的cid" />
        </el-form-item>
        <el-form-item label="1系统管理员 0普通用户" prop="level">
          <el-input v-model="form.level" placeholder="请输入1系统管理员 0普通用户" />
        </el-form-item>
        <el-form-item label="是否允许通过 id 搜索到我 1 是 2 否" prop="addMeId">
          <el-input v-model="form.addMeId" placeholder="请输入是否允许通过 id 搜索到我 1 是 2 否" />
        </el-form-item>
        <el-form-item label="是否允许加我为好友 1 是 2 否" prop="addMe">
          <el-input v-model="form.addMe" placeholder="请输入是否允许加我为好友 1 是 2 否" />
        </el-form-item>
        <el-form-item label="账户余额" prop="accountBalance">
          <el-input v-model="form.accountBalance" placeholder="请输入账户余额" />
        </el-form-item>
        <el-form-item label="冻结余额" prop="accountFrozen">
          <el-input v-model="form.accountFrozen" placeholder="请输入冻结余额" />
        </el-form-item>
        <el-form-item label="交易密码" prop="tradePwd">
          <el-input v-model="form.tradePwd" placeholder="请输入交易密码" />
        </el-form-item>
        <el-form-item label="提现冻结金额" prop="tixianFrozen">
          <el-input v-model="form.tixianFrozen" placeholder="请输入提现冻结金额" />
        </el-form-item>
        <el-form-item label="支付宝账户" prop="alipayAccount">
          <el-input v-model="form.alipayAccount" placeholder="请输入支付宝账户" />
        </el-form-item>
        <el-form-item label="支付宝名字" prop="alipayName">
          <el-input v-model="form.alipayName" placeholder="请输入支付宝名字" />
        </el-form-item>
        <el-form-item label="首字母" prop="pinyinChar">
          <el-input v-model="form.pinyinChar" placeholder="请输入首字母" />
        </el-form-item>
        <el-form-item label="密保问题" prop="mibaoWenti">
          <el-input v-model="form.mibaoWenti" placeholder="请输入密保问题" />
        </el-form-item>
        <el-form-item label="密保答案" prop="mibaoDaan">
          <el-input v-model="form.mibaoDaan" placeholder="请输入密保答案" />
        </el-form-item>
        <el-form-item label="身份证正面" prop="idCardZheng">
          <el-input v-model="form.idCardZheng" placeholder="请输入身份证正面" />
        </el-form-item>
        <el-form-item label="身份证反面" prop="idCardFan">
          <el-input v-model="form.idCardFan" placeholder="请输入身份证反面" />
        </el-form-item>
        <el-form-item label="积分" prop="integral">
          <el-input v-model="form.integral" placeholder="请输入积分" />
        </el-form-item>
        <el-form-item label="邀请码" prop="invitationCode">
          <el-input v-model="form.invitationCode" placeholder="请输入邀请码" />
        </el-form-item>
        <el-form-item label="被邀请码" prop="otherInvitationCode">
          <el-input v-model="form.otherInvitationCode" placeholder="请输入被邀请码" />
        </el-form-item>
        <el-form-item label="是否已推送审核通知 1是 2否" prop="notice">
          <el-input v-model="form.notice" placeholder="请输入是否已推送审核通知 1是 2否" />
        </el-form-item>
        <el-form-item label="${comment}" prop="deviceStr">
          <el-input v-model="form.deviceStr" placeholder="请输入${comment}" />
        </el-form-item>
        <el-form-item label="实名视频信息" prop="idCardVideo">
          <el-input v-model="form.idCardVideo" placeholder="请输入实名视频信息" />
        </el-form-item>
        <el-form-item label="邀请码是否启用 1启用 2禁用" prop="invitationCodeFlag">
          <el-input v-model="form.invitationCodeFlag" placeholder="请输入邀请码是否启用 1启用 2禁用" />
        </el-form-item>
        <el-form-item label="用户类型：内部  真实" prop="userFlag">
          <el-input v-model="form.userFlag" placeholder="请输入用户类型：内部  真实" />
        </el-form-item>
        <el-form-item label="最后一次登录ip" prop="ip">
          <el-input v-model="form.ip" placeholder="请输入最后一次登录ip" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { listImUser, getImUser, delImUser, addImUser, updateImUser } from "@/api/business/imUser"

export default {
  name: "ImUser",
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 即时通讯用户表格数据
      imUserList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        mobile: null,
        account: null,
        password: null,
        userName: null,
        realName: null,
        chatNumber: null,
        idCard: null,
        avatar: null,
        pyqBgImg: null,
        chatBgImg: null,
        signature: null,
        sex: null,
        address: null,
        email: null,
        lastLoginTime: null,
        activeStatus: null,
        userDeviceId: null,
        level: null,
        addMeId: null,
        addMe: null,
        accountBalance: null,
        accountFrozen: null,
        tradePwd: null,
        tixianFrozen: null,
        alipayAccount: null,
        alipayName: null,
        pinyinChar: null,
        mibaoWenti: null,
        mibaoDaan: null,
        idCardZheng: null,
        idCardFan: null,
        examineStatus: null,
        integral: null,
        invitationCode: null,
        otherInvitationCode: null,
        notice: null,
        deviceStr: null,
        idCardVideo: null,
        invitationCodeFlag: null,
        userFlag: null,
        ip: null
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
      }
    }
  },
  created() {
    this.getList()
  },
  methods: {
    /** 查询即时通讯用户列表 */
    getList() {
      this.loading = true
      listImUser(this.queryParams).then(response => {
        this.imUserList = response.rows
        this.total = response.total
        this.loading = false
      })
    },
    // 取消按钮
    cancel() {
      this.open = false
      this.reset()
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        mobile: null,
        account: null,
        password: null,
        userName: null,
        realName: null,
        chatNumber: null,
        idCard: null,
        avatar: null,
        pyqBgImg: null,
        chatBgImg: null,
        signature: null,
        sex: null,
        address: null,
        email: null,
        createTime: null,
        updateTime: null,
        lastLoginTime: null,
        activeStatus: null,
        delFlag: null,
        remark: null,
        userDeviceId: null,
        level: null,
        addMeId: null,
        addMe: null,
        accountBalance: null,
        accountFrozen: null,
        tradePwd: null,
        tixianFrozen: null,
        alipayAccount: null,
        alipayName: null,
        pinyinChar: null,
        mibaoWenti: null,
        mibaoDaan: null,
        idCardZheng: null,
        idCardFan: null,
        examineStatus: null,
        integral: null,
        invitationCode: null,
        otherInvitationCode: null,
        notice: null,
        deviceStr: null,
        idCardVideo: null,
        invitationCodeFlag: null,
        userFlag: null,
        ip: null
      }
      this.resetForm("form")
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1
      this.getList()
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm")
      this.handleQuery()
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset()
      this.open = true
      this.title = "添加即时通讯用户"
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset()
      const id = row.id || this.ids
      getImUser(id).then(response => {
        this.form = response.data
        this.open = true
        this.title = "修改即时通讯用户"
      })
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            updateImUser(this.form).then(response => {
              this.$modal.msgSuccess("修改成功")
              this.open = false
              this.getList()
            })
          } else {
            addImUser(this.form).then(response => {
              this.$modal.msgSuccess("新增成功")
              this.open = false
              this.getList()
            })
          }
        }
      })
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids
      this.$modal.confirm('是否确认删除即时通讯用户编号为"' + ids + '"的数据项？').then(function() {
        return delImUser(ids)
      }).then(() => {
        this.getList()
        this.$modal.msgSuccess("删除成功")
      }).catch(() => {})
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('business/imUser/export', {
        ...this.queryParams
      }, `imUser_${new Date().getTime()}.xlsx`)
    }
  }
}
</script>
